import numpy as np
from k_nearest_neighbors.kNN import knn_classify
from sklearn.neighbors import KNeighborsClassifier

raw_data_x = [[3.393533211, 2.331273381],  # y=0
              [3.110073483, 1.781539638],  # y=0
              [1.343808831, 3.368360954],  # y=0
              [3.582294042, 4.679179110],  # y=0
              [2.280362439, 2.866990263],  # y=0
              [7.423436942, 4.696522875],  # y=1
              [5.745051997, 3.533989803],  # y=1
              [9.172168622, 2.511101045],  # y=1
              [7.792783481, 3.424088941],  # y=1
              [7.939820817, 0.791637231]   # y=1
             ]
raw_data_y = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]

x_train = np.array(raw_data_x)
y_train = np.array(raw_data_y)

x_new_point = np.array([8.093607318, 3.365731514])

classify = knn_classify(6, x_train, y_train, x_new_point)
print(classify)

# use sklearn 中的 classifier
k_neighbors_classifier = KNeighborsClassifier(n_neighbors=6)
k_neighbors_classifier.fit(x_train, y_train)
k_neighbors_classifier.predict(x_new_point.reshape(1, -1))
